/*
 * quaternion.h
 *
 *  Created on: Nov 9, 2009
 *      Author: magnus
 */

#ifndef __SPACEDEFENDER_QUATERNION_H_
#define __SPACEDEFENDER_QUATERNION_H_
#include "cvector.h"
#include <iostream>
namespace spacedefender {

class Quaternion {
public:
	Quaternion();
	virtual ~Quaternion();
	double Length() const;
	void Normalize();

	void Rotate(const Vector &v, double angle);

	Quaternion GetInverse(const Quaternion &q);
	Quaternion operator * ( const Quaternion& rhs) const ;

	double _x;
	double _y;
	double _z;
	double _w;

	   inline friend std::ostream& operator <<
	            ( std::ostream& o, const Quaternion& q )
	        {
	            o << "Quaternion(" << q._w << ", " << q._x << ", " << q._y << ", " << q._z << ")";
	            return o;
	        }


private:
};

}

#endif /* __SPACEDEFENDER_QUATERNION_H_ */
